package com.ql.service.serviceImpl;

import com.ql.dao.SelectTemplateDao;
import com.ql.domain.request.SelectTemplate;
import com.ql.service.SelectTemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class SelectTemplateServiceImpl implements SelectTemplateService {
    @Autowired
    SelectTemplateDao selectTemplateDao;

    @Override
    public SelectTemplate findTemplate(String value,String userId) {
        return selectTemplateDao.findTemplate(value,userId);
    }

    @Override
    public List<SelectTemplate> findAll(String id) {
        return selectTemplateDao.findByUserId(id);
    }

    @Override
    public int update(SelectTemplate selectTemplate) {
        int update = selectTemplateDao.update(selectTemplate);
        if (update > 0) {
            return 1;
        }
        return 0;
    }

    @Override
    public int del(SelectTemplate selectTemplate) {
        return selectTemplateDao.del(selectTemplate);
    }

    @Override
    public int add(SelectTemplate selectTemplate) {
        return selectTemplateDao.add(selectTemplate);
    }
}
